/**
 * Free software.
 */

package org.nanhill.support.hibernate;

import java.util.Iterator;

import org.hibernate.Query;

/**
 * @author alin [xalinx at gmail dot com]
 * @date 2006-11-13
 */
public class HibernateKit {

	/**
	 * Init query.
	 * 
	 * @param q
	 * @param values
	 */
	public static void initQuery(Query q, Object... values) {
		for (int i = 0; i < values.length; i++) {
			q.setParameter(i, values[i]);
		}
	}

	/**
	 * Init query.
	 * 
	 * @param q
	 * @param values
	 */
	public static void initQuery(Query q, Iterator<Object> itt) {
		for (int i = 0; itt.hasNext(); i++) {
			q.setParameter(i, itt.next());
		}
	}
}
